#include"c14_T3_worker.h"
#include"c14_T3_template_pointerQueen.h"
#include<iostream>
#include<cstring>

int main()
{
	using std::cin;
	using std::cout;
	using std::endl;
	using std::strchr;

	const int WorkerMaxNum = 5;
	int workerNum = 0;

	Worker * workersPointerArray[WorkerMaxNum];

	int index;
	for (index = 0; index < WorkerMaxNum; index++)
	{
		char choice;
		cout << "Enter the employee category: \n"
			<< "w: waiter    s: singer    "
			<< "t: singing waiter    q: quit\n";
		cin >> choice;
		while (strchr("wstq", choice) == NULL)
		{
			cout << "Please enter the right character(w, s, t or q): ";
			cin >> choice;
		}
		if (choice == 'q')
			break;
		switch (choice)
		{
		case 'w':  workersPointerArray[index] = new Waiter;
			break;
		case 's':	 workersPointerArray[index] = new Singer;
			break;
		case 't': workersPointerArray[index] = new SingingWaiter;
			break;
		}
		cin.get();
		workersPointerArray[index]->Set();
		workerNum++;
	}

	cout << "\n Here is your staff: \n";
	for (int i = 0; i < workerNum; i++)
	{
		cout << endl;
		workersPointerArray[i]->Show();
	}

	cout << "\nNow we test the template_pointerQueen: \n";
	Queen<Worker *> workersQueen(WorkerMaxNum);
	Worker * workerDequeen[WorkerMaxNum];
	for (index = 0; index < workerNum; index++)
		workersQueen.EnQueen(workersPointerArray[index]);
	for (index = 0; index < workerNum; index++)
	{
		workersQueen.DeQueen(workerDequeen[index]);
		cout << endl;
		workerDequeen[index]->Show();
	}
	
	cout << "\nBye.\n";
	system("pause");
	return 0;
}